/****************************************************
    文件：LoginWnd.cs
	作者：kk
    邮箱: 627515104@qq.com
    日期：2020/8/26 15:29:7
	功能：Nothing
*****************************************************/

using UnityEngine;
using UnityEngine.UI;

public class LoginWnd : WindowRoot
{
    public InputField iptAcct;
    public InputField iptPass;
    public Button btnEnter;
    public Button btnNotice;

    protected  override void InitWnd()
    {
        base.InitWnd();
        if (PlayerPrefs.HasKey("Acct") && PlayerPrefs.HasKey("Pass"))
        {
            iptAcct.text = PlayerPrefs.GetString("Acct");
            iptPass.text = PlayerPrefs.GetString("Pass");
        }
        else
        {
            iptPass.text = "";
            iptAcct.text = "";
        }

        //更新本地存储的账号和密码
    }

    /// <summary>
    /// 
    /// </summary>
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);
        string acct = iptAcct.text;
        string pass = iptPass.text;

        if (acct != "" && pass != "")
        {
            PlayerPrefs.SetString("Acct",acct);
            PlayerPrefs.SetString("Pass",pass);
        }

        //发送网络消息，请求登陆
        LoginSys.Instance.RspLogion();
    }
}